package com.tancire.works.service.impl;

import java.util.List;
import javax.annotation.Resource;

import cn.hutool.core.util.IdUtil;
import com.tancire.common.utils.DateUtils;
import org.springframework.stereotype.Service;
import com.tancire.works.mapper.SideWorkTypeMapper;
import com.tancire.works.domain.SideWorkType;
import com.tancire.works.service.ISideWorkTypeService;

/**
 * 兼职类型Service业务层处理
 *
 * @author tancire
 * @date 2024-03-02
 */
@Service
public class SideWorkTypeServiceImpl implements ISideWorkTypeService {
    @Resource
    private SideWorkTypeMapper sideWorkTypeMapper;

    /**
     * 查询兼职类型
     *
     * @param id 兼职类型主键
     * @return 兼职类型
     */
    @Override
    public SideWorkType selectSideWorkTypeById(Long id) {
        return sideWorkTypeMapper.selectSideWorkTypeById(id);
    }

    /**
     * 查询兼职类型列表
     *
     * @param sideWorkType 兼职类型
     * @return 兼职类型
     */
    @Override
    public List<SideWorkType> selectSideWorkTypeList(SideWorkType sideWorkType) {
        return sideWorkTypeMapper.selectSideWorkTypeList(sideWorkType);
    }

    /**
     * 新增兼职类型
     *
     * @param sideWorkType 兼职类型
     * @return 结果
     */
    @Override
    public int insertSideWorkType(SideWorkType sideWorkType) {
        sideWorkType.setCreateTime(DateUtils.getNowDate());
        sideWorkType.setId(IdUtil.getSnowflakeNextId());
        return sideWorkTypeMapper.insertSideWorkType(sideWorkType);
    }

    /**
     * 修改兼职类型
     *
     * @param sideWorkType 兼职类型
     * @return 结果
     */
    @Override
    public int updateSideWorkType(SideWorkType sideWorkType) {
        sideWorkType.setUpdateTime(DateUtils.getNowDate());
        return sideWorkTypeMapper.updateSideWorkType(sideWorkType);
    }

    /**
     * 批量删除兼职类型
     *
     * @param ids 需要删除的兼职类型主键
     * @return 结果
     */
    @Override
    public int deleteSideWorkTypeByIds(Long[] ids) {
        return sideWorkTypeMapper.deleteSideWorkTypeByIds(ids);
    }

    /**
     * 删除兼职类型信息
     *
     * @param id 兼职类型主键
     * @return 结果
     */
    @Override
    public int deleteSideWorkTypeById(Long id) {
        return sideWorkTypeMapper.deleteSideWorkTypeById(id);
    }
}
